package com.kabigon.mall.multi.config;

import com.kabigon.mall.multi.config.intercecpter.IpUrlLimitIntercepter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author xu.biao
 * @version v1.0
 * @Package com.kabigon.mall.multi.config
 * @data 2022/6/5 23:08
 */
@Slf4j
@Configuration
public class MyWebAppConfig implements WebMvcConfigurer {

    @Bean
    public IpUrlLimitIntercepter getIpUrlLimitInterceptor() {
        return new IpUrlLimitIntercepter();
    }


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(getIpUrlLimitInterceptor()).addPathPatterns("/**");
    }
}
